#/usr/bin/python
#-*-<coding=UTF-8>-*-

"""
本例展示了多行文本及样式文本的使用
"""

import wx

class Frame(wx.Frame):
    
    def __init__(self):
        wx.Frame.__init__(self,parent=None,id=-1,title="",pos=wx.DefaultPosition,size=wx.DefaultSize)
        panel = wx.Panel(self,-1)
        multiLabel = wx.StaticText(panel,-1,"Multi-line")
        multiText = wx.TextCtrl(panel,-1,"Here is a loooooooooooooooooooooooooooooooooooong line of text set in the control.\n\n"
                "see that is wrapped ,and that this line is after a blank",
                size=(200,100),style=wx.TE_MULTILINE)
        multiText.SetInsertionPoint(0)

        richLabel = wx.StaticText(panel,-1,"Rich test")
        richText = wx.TextCtrl(panel,-1,"if suported by the native control,this is reversed,and "
                            "this is a different font.",size=(200,100),style=wx.TE_MULTILINE|wx.TE_RICH2)
        richText.SetInsertionPoint(0)
        richText.SetStyle(44,52,wx.TextAttr("white","black"))
        points = richText.GetFont().GetPointSize()
        font = wx.Font(points+3,wx.ROMAN,wx.ITALIC,wx.BOLD,True)
        richText.SetStyle(68,82,wx.TextAttr("blue",wx.NullColour,font))
        sizer = wx.FlexGridSizer(cols=2,hgap=5,vgap=5)
        sizer.AddMany([multiLabel,multiText,richLabel,richText])
        panel.SetSizer(sizer)


if __name__ == "__main__":
    app = wx.PySimpleApp()
    frame = Frame()
    frame.Show()
    app.MainLoop()
